<?php
namespace App\Services\ThirdPayments\Contracts;

use App\Exceptions\RechargeGatewayException;
use App\Lib\Code;
use App\Lib\ThirdPartyMap;
use App\Models\RechargeIf;
use App\Services\ThirdPayments\Recharge\AlipayPayment;
use App\Services\ThirdPayments\Recharge\CFYPayment;
use App\Services\ThirdPayments\Recharge\CYS8Payment;
use App\Services\ThirdPayments\Recharge\ECPSSPayment;
use App\Services\ThirdPayments\Recharge\EighteenPayment;
use App\Services\ThirdPayments\Recharge\ESDPayment;
use App\Services\ThirdPayments\Recharge\F1CardPayment;
use App\Services\ThirdPayments\Recharge\GFTPayment;
use App\Services\ThirdPayments\Recharge\HCADPayment;
use App\Services\ThirdPayments\Recharge\HeeypayPayment;
use App\Services\ThirdPayments\Recharge\HFBPayment;
use App\Services\ThirdPayments\Recharge\HFTXPayment;
use App\Services\ThirdPayments\Recharge\HYTongPayment;
use App\Services\ThirdPayments\Recharge\HYUNPayment;
use App\Services\ThirdPayments\Recharge\MCPayment;
use App\Services\ThirdPayments\Recharge\NinePayPayment;
use App\Services\ThirdPayments\Recharge\QIANYINGPayment;
use App\Services\ThirdPayments\Recharge\QIFPayment;
use App\Services\ThirdPayments\Recharge\QYFPayment;
use App\Services\ThirdPayments\Recharge\TJFPayment;
use App\Services\ThirdPayments\Recharge\TYFPayment;
use App\Services\ThirdPayments\Recharge\UPaysPayment;
use App\Services\ThirdPayments\Recharge\VSZFPayment;
use App\Services\ThirdPayments\Recharge\WEITEPayment;
use App\Services\ThirdPayments\Recharge\WSJFPayment;
use App\Services\ThirdPayments\Recharge\WYZFPayment;
use App\Services\ThirdPayments\Recharge\XKYPayment;
use App\Services\ThirdPayments\Recharge\YIKAPayment;
use App\Services\ThirdPayments\Recharge\YITENGPayment;
use App\Services\ThirdPayments\Recharge\YJPayment;
use App\Services\ThirdPayments\Recharge\ZHYUNPayment;
use App\Services\ThirdPayments\Recharge\RYFPayment;
use App\Services\ThirdPayments\Recharge\YINBAOPayment;

class RechargePaymentFactory
{
    public function getInstance($identify)
    {
        $instance = null;
        switch ($identify) {
            case ThirdPartyMap::QIANYIFU:
                $instance = new QYFPayment(); break;
            case ThirdPartyMap::HUICHAO:
                $instance = new ECPSSPayment(); break;
            case ThirdPartyMap::ESD:
                $instance = new ESDPayment(); break;
            case ThirdPartyMap::YIKA:
                $instance = new YIKAPayment(); break;
            case ThirdPartyMap::HUIFUBAO:
                $instance = new HFBPayment(); break;
            case ThirdPartyMap::WYZF:
                $instance = new WYZFPayment(); break;
            case ThirdPartyMap::WEITE:
                $instance = new WEITEPayment(); break;
            case ThirdPartyMap::F1Card:
                $instance = new F1CardPayment(); break;
            case ThirdPartyMap::Eighteen:
                $instance = new EighteenPayment(); break;
//            case ThirdPartyMap::NinePay:
//                $instance = new NinePayPayment(); break;
            case ThirdPartyMap::CFYPay:
                $instance = new CFYPayment(); break;
            case ThirdPartyMap::TYFPay:
                $instance = new TYFPayment(); break;
            case ThirdPartyMap::HCAD:
                $instance = new HCADPayment(); break;
            case ThirdPartyMap::TIANJF:
                $instance = new TJFPayment(); break;
            case ThirdPartyMap::DAPAI:
                $instance = new VSZFPayment(); break;
            case ThirdPartyMap::QIANYING:
                $instance = new QIANYINGPayment(); break;
            case ThirdPartyMap::ZHINENGYUN:
                $instance = new ZHYUNPayment(); break;
            case ThirdPartyMap::RUYIFU:
                $instance = new RYFPayment(); break;
            case ThirdPartyMap::ALIPAY:
                $instance = new AlipayPayment(); break;
            case ThirdPartyMap::WSJF:
                $instance = new WSJFPayment(); break;
            case ThirdPartyMap::YITENG:
                $instance = new YITENGPayment(); break;
            case ThirdPartyMap::HUIYOUTONG:
                $instance = new HYTongPayment(); break;
            case ThirdPartyMap::HENGFUTX:
                $instance = new HFTXPayment(); break;
            case ThirdPartyMap::MC:
                $instance = new MCPayment(); break;
            case ThirdPartyMap::UPays:
                $instance = new UPaysPayment(); break;
            case ThirdPartyMap::GFTONG:
                $instance = new GFTPayment(); break;
            case ThirdPartyMap::HYUN:
                $instance = new HYUNPayment(); break;
            case ThirdPartyMap::YUNJIAN:
                $instance = new YJPayment(); break;
            case ThirdPartyMap::YINBAO:
                $instance = new YINBAOPayment(); break;
            case ThirdPartyMap::CYS8:
                $instance = new CYS8Payment(); break;
            case ThirdPartyMap::XKYUN:
                $instance = new XKYPayment(); break;
            case ThirdPartyMap::QIFENG:
                $instance = new QIFPayment(); break;
            case ThirdPartyMap::AISHANG:
                $instance = new HeeypayPayment(); break;
            default:break;
        }
        if ($instance === null) {
            throw new RechargeGatewayException('本系统暂不支持此接口标识[' . $identify . ']', Code::RECHARGE_THIRD_LOG);
        }
        if ($identify instanceof RechargeIf) {
            $instance = $instance->initMchProfile($identify);
        }
        return $instance;
    }
}
